package jdbchomework;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-2-9
 */
public class Lab15 {
	public static void main(String[] args) {
		Connection con = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		int SIZE = 2; // 页面的长度is 5，
		int page = 2;// 页码

		try {
			con = JdbcTools.getConn();
			con.setAutoCommit(false);
			String sqlofpage = "select * from bbc limit " + SIZE + " offset "
					+ (page - 1) * SIZE;
			String sql = "select * from bbc ;";
			ps = con.prepareStatement(sql);
			rs = ps.executeQuery();
			JdbcTools.printRs(rs);
			con.commit();
		} catch (Exception e) {
			e.getMessage();
			try {
				con.rollback();
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		} finally {
			JdbcTools.close(null, ps, con);
		}
	}
}
